{{!
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
}}

{{#if loaded}}
  {{#if model.app.entityID}}
    <table class='detail-list'>
      <thead>
      <tr>
        <th colspan=2>YARN App Details</th>
      </tr>
      </thead>
      <tbody>
      <tr>
        <td>Status</td>
        <td>{{em-table-status-cell content=model.app.status}}</td>
      </tr>
      <tr>
        <td>Final Status</td>
        <td>{{em-table-status-cell content=model.app.finalStatus}}</td>
      </tr>
      <tr>
        <td>Start Time</td>
        <td>{{date-formatter content=model.app.startTime}}</td>
      </tr>
      <tr>
        <td>End Time</td>
        <td>{{date-formatter content=model.app.endTime}}</td>
      </tr>
      <tr>
        <td>Duration</td>
        <td>{{txt model.app.duration type="duration"}}</td>
      </tr>
      </tbody>
    </table>

    <table class='detail-list'>
      <thead>
      <tr>
        <th colspan=2>YARN App Description</th>
      </tr>
      </thead>
      <tbody>
      <tr>
        <td>Application Tracking URL</td>
        <td><a href={{trackingURL}} target="_blank">{{model.app.entityID}}</a></td>
      </tr>
      <tr>
        <td>Application Name</td>
        <td>{{model.app.name}}</td>
      </tr>
      <tr>
        <td>Queue</td>
        <td>{{model.app.queue}}</td>
      </tr>
      <tr>
        <td>Application Type</td>
        <td>{{model.app.type}}</td>
      </tr>
      <tr>
        <td>User</td>
        <td>{{model.app.user}}</td>
      </tr>
      </tbody>
    </table>
  {{/if}}

  {{#if model.entityID}}
    <table class='detail-list'>
      <thead>
      <tr>
        <th colspan=2>Tez Details</th>
      </tr>
      </thead>
      <tbody>
      <tr>
        <td>Entity ID</td>
        <td>{{model.entityID}}</td>
      </tr>
      <tr>
        <td>Domain</td>
        <td>{{model.domain}}</td>
      </tr>
      <tr>
        <td>User</td>
        <td>{{model.user}}</td>
      </tr>
      </tbody>
    </table>

    <table class='detail-list'>
      <thead>
      <tr>
        <th colspan=2>Version Details</th>
      </tr>
      </thead>
      <tbody>
      <tr>
        <td>Build Version</td>
        <td>{{model.tezVersion}}</td>
      </tr>
      <tr>
        <td>Build Revision</td>
        <td>{{model.tezRevision}}</td>
      </tr>
      <tr>
        <td>Build Time</td>
        <td>{{model.buildTime}}</td>
      </tr>
      </tbody>
    </table>
  {{/if}}

  {{#unless (and model.entityID model.app.entityID)}}
    <h2>Some data is not available!</h2>
    <h5>No data returned from URL:
      <i>
        {{#unless model.entityID}}
          {{hosts.timeline}}/{{env.app.namespaces.webService.timeline}}/{{env.app.paths.timeline.app}}/tez_{{model.appID}}
        {{/unless}}
        {{#unless model.app.entityID}}
          {{#unless model.entityID}}
            &
          {{/unless}}
          {{hosts.timeline}}/{{env.app.namespaces.webService.appHistory}}/apps/{{model.appID}}
        {{/unless}}
      </i>.
      The data may not be available in YARN Timeline or you may not have the necessary permissions to view this data.
    </h5>
  {{/unless}}

{{else}}
  {{partial "loading"}}
{{/if}}
